//
//  DPushView.m
//  生日趴-框架
//
//  Created by douglas on 2018/11/16.
//  Copyright © 2018 Zhang. All rights reserved.
//

#import "DPushView.h"
#import "Masonry.h"
@implementation DPushView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (UIImageView *)pushIcon {
    if (!_pushIcon) {
        _pushIcon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
        [self addSubview:_pushIcon];
        [_pushIcon mas_makeConstraints:^(MASConstraintMaker *make) {
           // make.left.equalTo(@(10));
            make.centerX.equalTo(self.mas_centerX);
            make.bottom.equalTo(self.pushLable.mas_top).offset(-10);
            make.height.equalTo(@(50));
            make.width.equalTo(@(50));
        }];
    }
    return _pushIcon;
}
- (UILabel *)pushLable {
    if (!_pushLable) {
        _pushLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
        _pushLable.textColor = [UIColor lightGrayColor];
        _pushLable.font = [UIFont systemFontOfSize:14];
        _pushLable.numberOfLines = 2;
        _pushLable.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_pushLable];
        [_pushLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(10));
            make.height.equalTo(@(60));
            make.right.equalTo(@(10));
            make.centerY.equalTo(self.mas_centerY);
        }];
    }
    return _pushLable;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    if (self.needCall && self.callBack) {
        self.callBack();
    }
}
@end
